package com.itheima.mStringTest;

import java.util.Random;

public class WorkStringTest05 {
    public static void main(String[] args) {
        //定义长度为26,元素值为26个大写字母的数组
        String s = "QWERTYUIOPASDFGHJKLZXCVBNM";
        char[] chs = s.toCharArray();
        String str = getStr(chs);
        System.out.println(str);
    }

    public static String getStr(char[] chs) {
        Random r = new Random();
        int index;
        String s = "";
        for (int i = 0; i < 4; i++) {
            index = r.nextInt(chs.length);
            s += chs[index];
        }
        s += r.nextInt(10);
        return s;
    }
}
